<template>
  <cv-filter
    :config="filterConfig"
    :data="storeSearch"
    @query="
      () => {
        emit('query', from)
      }
    "
    @reset="
      () => {
        emit('reset', from)
      }
    "
  ></cv-filter>
</template>
<script setup lang="ts">
import { FilterConfig } from '@/packages/components'
const emit = defineEmits(['query', 'reset'])
const props = defineProps({
  /**
   * 筛选的属性字段
   */
  storeSearch: {
    type: Object,
    default: () => {
      return {}
    },
  },
})

const from = reactive({
  categoryName: '',
})
/**
 * 筛选配置
 */
const filterConfig = reactive<FilterConfig<any>>({
  items: [
    {
      type: 'input',
      prop: 'specsName',
      label: '参数名',
    },
    {
      type: 'input',
      prop: 'specsValue',
      label: '参数值',
    },
    {
      type: 'select',
      prop: 'specsType',
      label: '参数类型',
      select: {
        value: 'value',
        label: 'label',
        initData: async ({ setData }) => {
          // const res = await getSpecsSelect()
          console.log(111)
          // setData(res.data)
        },
      },
    },
  ],
})
</script>
<style lang="scss" scoped></style>
